<template>
  <div>
    <flex height="auto" class="tab">
      <flex-item col="25%" @click="onClick($event,1)">
        <span>全部类目</span><span>▼</span><span>▲</span>
      </flex-item>
      <flex-item col="25%" @click="onClick($event,2)">
        <span>附近商家</span><span>▼</span><span>▲</span>
      </flex-item>
      <flex-item col="25%" @click="onClick($event,3)">
        <span>智能排序</span><span>▼</span><span>▲</span>
      </flex-item>
      <flex-item col="25%" @click="onClick($event,4)">
        <span>筛选</span><span>▼</span><span>▲</span>
      </flex-item>
    </flex>
    <div class="content">
      <div class="content1">
        <div class="wraper" v-for="(item,index) in cates">
          <span class="iconfont icon-arrow_down"></span>
          <span class="name">{{item.name}}</span>
          <span class="number">{{item.number}}</span>
        </div>
      </div>
      <div class="content2">
        <div class="wraper" v-for="(item,index) in stores">
          <span class="iconfont icon-arrow_down"></span>
          <span class="name">{{item.name}}</span>
          <span class="number">{{item.number}}</span>
        </div>
      </div>
      <div class="content3">
        <div class="wraper">
          <span class="iconfont icon-arrow_down"></span>
          <span class="name">智能排序</span>
        </div>
        <div class="wraper">
          <span class="iconfont icon-arrow_down"></span>
          <span class="name">离我最近</span>
        </div>
        <div class="wraper">
          <span class="iconfont icon-arrow_down"></span>
          <span class="name">好评优先</span>
        </div>
        <div class="wraper">
          <span class="iconfont icon-arrow_down"></span>
          <span class="name">人气最高</span>
        </div>
      </div>
      <div class="content4">

      </div>
    </div>
  </div>
</template>

<script>
    import flex from '@/components/layout/flex';
    import flexItem from '@/components/layout/flexItem';
    export default {
        name: "list",
        props:{
          cates:{
            type:Array,
            default:function () {
              return [
                {
                  name:'全城',
                  number:0
                }
              ];
            }
          },
          stores:{
            type:Array,
            default:function () {
              return [
                {
                  name:'全城',
                  number:0
                }
              ];
            }
          }
        },
        data(){
          return {

          }
        },
        components:{
          flex,
          flexItem
        },
        mounted() {
            console.log($('.wraper'))
        },
        methods:{
            onClick:function (e,i) {
              console.log(e,i);

              $('.content').children(':not(.content'+i+')').hide();
              $('.content'+i).show();
            }
        }
    }
</script>

<style lang="less" scoped>
  .wraper{
    height: 50px;
    line-height: 50px;
    font-size: 1.6rem;
    text-align: left;
    padding: 0px 20px;
    border:  1px solid gray;
  }
  .tab{
    font-size: 1.4rem;
    height: 50px;
    line-height: 50px;
  }
  .icon-arrow_down{
    font-size: 2rem;
  }
  .name{

  }
  .number{
    float: right;
  }
  .content2,.content3,.content4{
    display: none;
  }
</style>
